package com.itheima.runnable;

import com.itheima.thread.MyThread;

public class RunnableDemo01 {
    public static void main(String[] args) {
        //Runnable接口的实现类对象
        MyRunnable mr = new MyRunnable();
        //Thread对象，以mr为参数去实例化
        Thread t1 = new Thread(mr);
//        Thread t2 = new Thread(mr);
        //开启线程，实际执行的run()方法是，mr中重写的run()方法
        t1.start();
//        t2.start();

        //main方法的输出语句，会和t1线程交替执行
        for (int i = 0; i < 100; i++) {
            System.out.println("main:" + i);
        }
    }
}
